<template>
    <div>
        <div class="myLoading">
            <h4>{{title}}</h4>
           <div style="text-align:center; padding:50px 0;">{{content}}</div>
            <slot></slot>
            <button @click="hide">关闭</button>
        </div>
    </div>
</template>

<script>
export default {
    name: 'MyLoading',
    props: {
        title: {
            type: String,
            default: '提示'
        },
        content: {
           type: String,
            default: '加载中...' 
        }
    },

    data() {
        return {
            
        };
    },

    mounted() {
        
    },

    methods: {
        hide () {
            this.$MyLoading.hide(() => {
                console.log('已关闭并且回调了2');
            })
        }
    },
};
</script>

<style scoped>
*{
    margin:0;
    padding:0;
}
.myLoading {
    position:fixed;
    left:50%;
    top:50%;
    transform: translate(-50%,-50%);
    z-Index:1000;
    width:200px;
    height:200px;
    border-radius:10px; 
    background: #fff;
    box-shadow:0 0 10px rgba(0,0,0,0.8);
}
.myLoading  h4{
    width:100%;
    padding-left:10px;
    padding-top:10px;
}
.myLoading  button{
   position:absolute;
   right:10px;
   bottom:10px;
   padding:0 10px;
}

</style>